package jroguelike.main.proto;

import aimozg.joglfw.GLColor;
import jroguelike.main.ItemClass;
import jroguelike.main.RLItem;
import jroguelike.main.World;
import jroguelike.main.items.MeleeWeapon;
import jroguelike.utils.Dice;

/**
 * Created by IntelliJ IDEA.
 * User: aimozg
 * Date: 31.07.11
 * Time: 23:53
 */
public class ItemProtos {

	public static final char DEFAULT_CHAR_MELEE = '/';
	public static final char DEFAULT_CHAR_LIGHT = ')';
	public static final char DEFAULT_CHAR_HEAVY = ']';
	public static final char DEFAULT_CHAR_ENERGY = '}';
	public static final char DEFAULT_CHAR_AMMO_LIGHT = '"';
	public static final char DEFAULT_CHAR_AMMO_HEAVY = '|';
	public static final char DEFAULT_CHAR_AMMO_ENERGY = '^';
	public static final char DEFAULT_CHAR_ARMOR = '[';
	public static final char DEFAULT_CHAR_CHEM = '+';
	public static final char DEFAULT_CHAR_FOOD = '%';
	public static final char DEFAULT_CHAR_DRINK = '!';
	public static final char DEFAULT_CHAR_JUNK = ';';
	public static final char DEFAULT_CHAR_MONEY = '$';
	public static final char DEFAULT_CHAR_MISC = '?';

	public static final GLColor DEFAULT_COLOR_COMMON = GLColor.GRAY;
	public static final GLColor DEFAULT_COLOR_GOOD = GLColor.WHITE;
	public static final GLColor DEFAULT_COLOR_RARE = GLColor.BLUE;
	public static final GLColor DEFAULT_COLOR_EXCEPTIONAL = GLColor.GREEN;
	public static final GLColor DEFAULT_COLOR_QUEST = GLColor.ORANGE;

	public final MeleeWeapon wKnife;
	public final MeleeWeapon wCombatKnife;
	public final RLItem aVault13Jumpsuit;
	public final RLItem aAdvancedPowerArmor;
	public final RLItem uHealingPowder;
	public final RLItem uStimpack;
	public final RLItem xVaultWaterChip;
	public final RLItem x9mmAmmo;

	// TODO durability, price, weight, stack size
	private void initMain(RLItem item, String name, char glyph, GLColor fg) {
		item.name = name;
		item.glyph = glyph;
		item.color = fg;
	}

	// TODO action points, damage type
	private void initMelee(MeleeWeapon item, Dice damage) {
		item.damage = damage;
	}

	public ItemProtos(World w) {
		wKnife = new MeleeWeapon();
		initMain(wKnife, "knife", DEFAULT_CHAR_MELEE, DEFAULT_COLOR_COMMON);
		initMelee(wKnife, Dice.parse("1d6"));

		wCombatKnife = new MeleeWeapon();
		initMain(wCombatKnife, "combat knife", DEFAULT_CHAR_MELEE, DEFAULT_COLOR_GOOD);
		initMelee(wCombatKnife, Dice.parse("2d4"));

		aVault13Jumpsuit = new RLItem(ItemClass.ARMOR);
		initMain(aVault13Jumpsuit, "Vault 13 jumpsuit", DEFAULT_CHAR_ARMOR, GLColor.BLUE);

		aAdvancedPowerArmor = new RLItem(ItemClass.ARMOR);
		initMain(aAdvancedPowerArmor, "advanced power armor", DEFAULT_CHAR_ARMOR, DEFAULT_COLOR_EXCEPTIONAL);

		uHealingPowder = new RLItem(ItemClass.USEABLE);
		initMain(uHealingPowder, "healing powder", DEFAULT_CHAR_CHEM, DEFAULT_COLOR_COMMON);

		uStimpack = new RLItem(ItemClass.USEABLE);
		initMain(uStimpack, "stimpack", DEFAULT_CHAR_CHEM, DEFAULT_COLOR_GOOD);

		xVaultWaterChip = new RLItem(ItemClass.UNUSABLE);
		initMain(xVaultWaterChip, "Vault water chip", DEFAULT_CHAR_MISC, DEFAULT_COLOR_QUEST);

		x9mmAmmo = new RLItem(ItemClass.UNUSABLE);
		initMain(x9mmAmmo, "9mm ammo", DEFAULT_CHAR_AMMO_LIGHT, DEFAULT_COLOR_COMMON);
	}
}
